﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using testapp.ViewModels;

namespace SCTO.Center
{
    public class SctoFileInfo
    {
        public string? FileName { get; set; }
        public string? Signature { get; set; }

        public override string ToString()
        {
            return $"文件名：{FileName}\t\t签名{Signature}";
        }

        public static IEnumerable<FileInfoViewModel> ToViewModel(IEnumerable<SctoFileInfo> sctoFiles)
        {
            foreach (var file in sctoFiles)
                yield return new FileInfoViewModel
                {
                    Date = DateTime.Now.ToString("yyyy年MM月dd日"),
                    FileName = file.FileName ?? string.Empty,
                    FileSize = file.Signature ?? string.Empty
                };
        }
    }

    public class ClientInfo
    {
        public string? Client { get; set; }
        public string? PublicKey { get; set; }

        public override string ToString()
        {
            return "节点：" + Client;
        }
    }
}
